package com.zx.sa.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.openai.OpenAiChatOptions;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/*
设置一个平台，多个模型
 */
@Configuration
public class AiModelConfig {

    @Primary
    @Bean(name = "openai")
    public ChatClient openai(ChatModel chatModel) {
        OpenAiChatOptions aiChatOptions = OpenAiChatOptions.builder()
                .model("openai/gpt-oss-20b").build();

        return ChatClient.builder(chatModel)
                .defaultOptions(aiChatOptions)
                .build();
    }

    @Bean(name = "gemini")
    public ChatClient gemini(ChatModel chatModel) {
        OpenAiChatOptions aiChatOptions = OpenAiChatOptions.builder()
                .model("google/gemini-2.0-flash-exp").build();

        return ChatClient.builder(chatModel)
                .defaultOptions(aiChatOptions)
                .build();
    }
}
